package cn.com.xxlibrary.service.impl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import cn.com.xxlibrary.dao.ISearchDao;
import cn.com.xxlibrary.service.ISearchService;

@Service
@Repository("searchService")
public class SearchServiceImpl implements ISearchService {

	@Resource
	ISearchDao searchDao;

	@Override
	public Map search(int bt, int bd, int sType, String sValue, int start,
			int pageSize) {
		Map map = null;
		String[] sTypes = { " ", "bookCallNo", "bookBarCode", "ISBN",
				"periNo", "bookName","bookChargePerson","bookPublishing" };
		if (sType == 0) {
			map = searchDao.queryFromAll(bt, bd, sValue, start, pageSize);
		} else {
			map = searchDao.queryFromOne(bt, bd, sTypes[sType], sValue, start,
					pageSize);
		}
		return map;
	}


}
